***************************************************************************
*** Money Backfires														***
*** How Chinese Investment Fuels Anti-China Protests Abroad				***		
*** Dec 2023															***
***************************************************************************
use "MoneyBackfires_WD.dta", clear

xtset cowcode year


* Table 1: THe Effect of Chinese FDI on Anti-China Protest (with Polcomp)

eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  lndist bri_carryover v2x_polyarchy  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  lndist bri_carryover v2x_polyarchy  year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy eventcountL1 i.year , fe
esttab using "table1.tex", label drop(  *year* _cons )  nonotes se(3) b(4) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps  nobase nodepvars mtitles("" "" "" "" "" "") stats(N N_g, fmt(0 0 ) label(Observations Countries ))
 

* Figure 3
eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.polcompL1   i.year , fe
margins,  dydx(ln_cofdi_stock_gdp_L1 ) at (polcompL1  =(1(2)10))
marginsplot,yscale(alt) yline(0) recast(line) plotopts(lw(medthick)) recastci(rline) ciopts(lp(dash)) ytitle("") xtitle("Political competition (polcomp)") title("") level(90) graphregion(fcolor(white)) legend(off) saving(polcomp,replace)
 
eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   i.year , fe
margins,  dydx(ln_cofdi_stock_gdp_L1 ) at (parcompL1  =(0(1)5))
marginsplot,yscale(alt) yline(0) recast(line) plotopts(lw(medthick)) recastci(rline) ciopts(lp(dash))  ytitle("") xtitle("Competitiveness of Participation (parcomp)") title("") level(90) graphregion(fcolor(white)) legend(off) saving(parcomp,replace)

eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   i.year , fe

margins,  dydx(ln_cofdi_stock_gdp_L1 ) at (avgcompL1  =(0(1)4))
marginsplot,yscale(alt) yline(0) recast(line) plotopts(lw(medthick))  ytitle("") xtitle("Competition for participation" "and executive recruitment (xrparcomp)") title("")  recastci(rline) ciopts(lp(dash))   level(90) graphregion(fcolor(white)) legend(off) saving(avgcomp,replace)

graph combine "polcomp" "parcomp" "avgcomp", col(2) graphregion(fcolor(white))





*Table 2:  Chinese Money and Anti-China Protests

eststo clear
eststo:xtnbreg  eventcount    c.ChinaTradeOpennessL1##c.polcompL1 v2x_polyarchy   lngdp   lngdppc  urban_pop electricity NaturalResources  tradeopenness nonchinese_fdi_inflow_gdp  lndist bri_carryover  eventcountL1    i.year , fe
eststo:xtnbreg  eventcount    c.ChinaTradeOpennessL1##c.parcompL1 v2x_polyarchy     lngdp   lngdppc  urban_pop electricity NaturalResources  tradeopenness nonchinese_fdi_inflow_gdp lndist bri_carryover  eventcountL1    i.year , fe
eststo:xtnbreg  eventcount    c.ChinaTradeOpennessL1##c.avgcompL1  v2x_polyarchy     lngdp   lngdppc  urban_pop electricity NaturalResources tradeopenness nonchinese_fdi_inflow_gdp   lndist bri_carryover  eventcountL1    i.year , fe
eststo:xtnbreg  eventcount    c.OFa_all_gdp_ln_L1##c.polcompL1   v2x_polyarchy  lngdp   lngdppc  urban_pop electricity NaturalResources tradeopenness nonchinese_fdi_inflow_gdp   lndist bri_carryover   eventcountL1   i.year , fe
eststo:xtnbreg  eventcount    c.OFa_all_gdp_ln_L1##c.parcompL1    v2x_polyarchy  lngdp   lngdppc  urban_pop electricity NaturalResources tradeopenness nonchinese_fdi_inflow_gdp  lndist bri_carryover   eventcountL1   i.year , fe
eststo:xtnbreg  eventcount    c.OFa_all_gdp_ln_L1##c.avgcompL1     v2x_polyarchy  lngdp   lngdppc  urban_pop electricity NaturalResources tradeopenness nonchinese_fdi_inflow_gdp  lndist bri_carryover    eventcountL1  i.year , fe
esttab using "table2.tex", label drop(  *year* _cons lngdp   v2x_polyarchy lngdppc  urban_pop electricity NaturalResources tradeopenness nonchinese_fdi_inflow_gdp  lndist bri_carryover    eventcountL1 )   nonotes se(3) b(4) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps  nobase nodepvars mtitles("" "" "" "" "" "") stats(N N_g, fmt(0 0 ) label(Observations Countries ))




*Table 3: Non-Chinese FDI and Anti-China Protests in Developing Countries.
eststo clear
eststo:xtnbreg  eventcount    c.ln_nonchinese_fdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness lndist bri_carryover v2x_polyarchy  i.year if developed==0 , fe
eststo:xtnbreg  eventcount    c.ln_nonchinese_fdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness  lndist bri_carryover v2x_polyarchy  i.year if developed==0 , fe
eststo:xtnbreg  eventcount    c.ln_nonchinese_fdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness   lndist bri_carryover v2x_polyarchy  i.year if developed==0 , fe
eststo:xtnbreg  eventcount    c.ln_ofdi_stock_gdp_L1##c.polcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness  lndist bri_carryover v2x_polyarchy   i.year if developed==0 , fe
eststo:xtnbreg  eventcount    c.ln_ofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness  lndist bri_carryover v2x_polyarchy  i.year if developed==0 , fe
eststo:xtnbreg  eventcount    c.ln_ofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity  NaturalResources tradeopenness  lndist bri_carryover v2x_polyarchy  i.year if developed==0 , fe
esttab using "table3.tex", label drop(  *year* _cons lngdp   v2x_polyarchy lngdppc  urban_pop electricity NaturalResources tradeopenness   lndist bri_carryover  )  nonotes se(3) b(4) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps  nobase nodepvars mtitles("" "" "" "" "" "") stats(N N_g, fmt(0 0 ) label(Observations Countries ))


*summary statistics*
sutex2  eventcount   ln_cofdi_stock_gdp ChinaTradeOpenness OFa_all_gdp_ln polcomp parcomp avgcomp  lngdp   lngdppc urban_pop electricity  NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy if eventcount~=., minmax varlabels





* Table A2

eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  lndist bri_carryover  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy  year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.parcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources tradeopenness ln_nonchinese_fdi_stock_gdp  lndist bri_carryover v2x_polyarchy eventcountL1 i.year , fe
esttab using "table_a2.tex", label drop(  *year*  _cons )  nonotes se(3) b(4) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps  nobase nodepvars mtitles("" "" "" "" "" "") stats(N N_g, fmt(0 0 ) label(Observations Countries ))





* Table A3


eststo clear
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity    NaturalResources i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  tradeopenness ln_nonchinese_fdi_stock_gdp  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  tradeopenness ln_nonchinese_fdi_stock_gdp  lndist bri_carryover  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy  i.year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy  year , fe
eststo:xtnbreg  eventcount    c.ln_cofdi_stock_gdp_L1##c.avgcompL1   lngdp   lngdppc  urban_pop electricity   NaturalResources  tradeopenness ln_nonchinese_fdi_stock_gdp   lndist bri_carryover v2x_polyarchy eventcountL1 i.year , fe
esttab using "table_a3.tex", label drop(  *year*  _cons )  nonotes se(3) b(4) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps  nobase nodepvars mtitles("" "" "" "" "" "") stats(N N_g, fmt(0 0 ) label(Observations Countries ))




 



